import java.util.Arrays;

public class tay10 {
    public static void main(String[] args) {
        int[] arr = {10,20,30,40,50};
        int[] interchange = interchange(arr);
        System.out.println(Arrays.toString(interchange));
    }
    public static int[] interchange(int[] arr){
        int temp = arr[0];
        arr[0]=arr[arr.length-1];
        arr[arr.length-1]=temp;
        return arr;
    }
}

